<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title></title>
    [#include "/admin/include/admin_static.htm"]
    <script type="text/javascript">
        $(function () {
            layui.use(['form', 'layer','upload','layedit'], function () {
                var form = layui.form(), $ = layui.jquery, layer = layui.layer,upload = layui.upload,layedit = layui.layedit;
                layui.upload({
                    url: '/system/upload/submit.aspx'
                    ,success: function(res){
                        if (res["error"] == 0) {
                            $("#urlImg").attr("src", res["url"]);
                            $("#url").val(res["url"]);
                        } else {
                            layui.alert(res["message"]);
                        }
                    }
                });

                form.on('submit(saveForm)', function (data) {
                    var index = layer.load();
                    ajax({
                        url: "${path}/admin/advert/edit.aspx",
                        data: data.field,
                        success: function (result) {
                            layer.msg(result.content, {time:2000},function () {
                                location.href="${path}/admin/advert/list.aspx";
                            });
                            layer.close(index);
                        },
                        complete: function () {
                            layer.close(index);
                        }

                    });
                    return false;
                });
            });
        });
    </script>

</head>
<body>
<div class="main_admin_content">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>添加广告位</legend>
    </fieldset>
    <form class="layui-form">
        <table class="main_edit_table">


            <div class="layui-form-item">
                <label class="layui-form-label">选择文件：</label>
                <div class="layui-input-block" style="margin-left: 150px">
                    <img src="${ppt.img_src}" id="urlImg"  >
                    <input type="file"  name="file" id="${parameter.code }"  class="layui-upload-file"/>
                    <input type="hidden" id="url" name="img_src" value="${ppt.img_src }"/>
                </div>
            </div>


            <input type="hidden" name="dis_order" value="${ppt.dis_order!'0'}">
            <input type="hidden" name="id" value="${ppt.id!''}">

            <div class="layui-form-item">
                <label class="layui-form-label">链接地址：</label>
                <div class="layui-input-block" style="margin-left: 150px">

                    <input type="text" class="layui-input"  name="img_link"  value="${ppt.img_link}"/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">状态：</label>
                <div class="layui-input-block" style="margin-left: 150px">

                    <select name="is_display">
                        <option
                        [#if ppt.is_display==1 ]selected[/#if]
                        value="1">显示
                        </option>
                        <option
                        [#if ppt.is_display==0 ]selected[/#if]
                        value="0">隐藏
                        </option>
                    </select>
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">详情：</label>
                <div class="layui-input-block" style="margin-left: 150px">

                    <textarea name="explanation" rows="4" cols="30" class="layui-textarea">${ppt.explanation }</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">种类：</label>
                <div class="layui-input-block" style="margin-left: 150px">
                [@u.radio  name="category" list={'1': 'pc', '2':'手机端'}  class="layui-radio" value=ppt.category /]
                </div>
            </div>


            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button lay-submit lay-filter="saveForm" class="layui-btn" style="width: 280px;margin-top:3px;">保存</button>
                </div>
            </div>

        </table>
    </form>
</div>
</body>
</html>